home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
programr
/
rsxwdk2s.zip
/
RSXWDK
/
LIBSRC
/
WIN
/
MEMCOPY.S
< prev
next >
Wrap
Text File
|
1994-10-11
|
1KB
|
85 lines
.text
//
// Move data from 16:16 to user program offset
// void _memcpy_from_far(void *offset32, DWORD far16, WORD bytes);
//
.align 2, 0x90
.globl __memcpy_from_far
__memcpy_from_far:
pushl %esi
pushl %edi
pushl %ds
movl 4*4(%esp), %edi
movzwl 5*4(%esp), %esi
movw 5*4+2(%esp), %ax
movw %ax, %ds
movl 6*4(%esp), %ecx
shrl $2, %ecx
rep
movsl
movl 6*4(%esp), %ecx
andl $3, %ecx
rep
movsb
movl 4*4(%esp), %eax
popl %ds
popl %edi
popl %esi
ret
//
// Move data from user program offset to 16:16 pointer
// void _memcpy_to_far(DWORD far16, void *offset32, WORD bytes);
//
.align 2, 0x90
.globl __memcpy_to_far
__memcpy_to_far:
pushl %esi
pushl %edi
pushl %es
movzwl 4*4(%esp), %edi
movw 4*4+2(%esp), %ax
movl 5*4(%esp), %esi
movw %ax, %es
movl 6*4(%esp), %ecx
shrl $2, %ecx
rep
movsl
movl 6*4(%esp), %ecx
andl $3, %ecx
rep
movsb
movl 5*4(%esp), %eax
popl %es
popl %edi
popl %esi
ret
//
// Move string from 16:16 to user program offset
// void strcpy_fardest(offset32,far16);
//
.align 2, 0x90
.globl __strcpy_from_far
__strcpy_from_far:
pushl %esi
pushl %edi
pushl %ds
movl 4*4(%esp), %edi
movzwl 5*4(%esp), %esi
movw 5*4+2(%esp), %ax
movw %ax, %ds
.align 2, 0x90
1: lodsb
stosb
orb %al, %al
jnz 1b
movl 4*4(%esp), %eax
popl %ds
popl %edi
popl %esi
ret